<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="format-detection" content="telephone=no" />
  <meta name="format-detection" content="email=no" />
  <script src="../scripts/rem.js"></script>
  <title>万果田园 资讯</title>
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" href="../styles/global.css">
  <link rel="stylesheet" href="../styles/information.css">
</head>

<body>
  <header class="header">
    <div class="logo">
      <a href="index.html">
        <img src="../images/logo.png" alt="">
      </a>
    </div>
    <div class="classify">
      <img src="../images/classify.png" alt="">
    </div>
    <nav class="nav">
      <ul class="nav-list">
        <li class="list">
          <a href="index.html">
            <div>首页</div>
            <div></div>
          </a>
        </li>
        <li class="list">
          <a href="survey.html">
            <div>概况</div>
            <div></div>
          </a>
        </li>
        <li class="list">
          <a href="javascript:;">
            <div>资讯</div>
            <div class="active"></div>
          </a>
        </li>
        <li class="list">
          <a href="business.html">
            <div>业务</div>
            <div></div>
          </a>
        </li>
        <li class="list">
          <a href="layout.html">
            <div>布局</div>
            <div></div>
          </a>
        </li>
        <li class="list">
          <a href="latest.html">
            <div>动态</div>
            <div></div>
          </a>
        </li>
        <li class="list">
          <a href="record.html">
            <div>全程追溯</div>
            <div></div>
          </a>
        </li>
        <li class="list">
          <a href="introduce-join.html">
            <div>合作</div>
            <div></div>
          </a>
        </li>
        <li class="list">
          <a href="download.html">
            <div>APP下载</div>
            <div></div>
          </a>
        </li>
      </ul>
    </nav>
  </header>
  <main>
    <ul class="information-list">
      <li class="paceholder">
        <div class="paceholder-bg"></div>
        <div class="tc paceholder-tip">没有更多数据了</div>
      </li>
    </ul>
    <div class="tip-placeholder">没有更多数据了</div>
    <ul class="pagination" id="pagination1"></ul>
  </main>
  <footer>
    <div class="phone">电话：400-017-5917</div>
    <div class="email">邮箱：postmaster@wggyl.cn</div>
    <div class="address">地址：北京市丰台区新发地京良桥西南侧2000米路北丰合顺市场5号交易厅商01号</div>
    <div class="name-icp">万果供应链科技有限公司 京ICP备17068845号</div>
  </footer>
  <div class="loading">
    <div class="load-gif"></div>
  </div>
  <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
  <script src="../scripts/main.js"></script>
  <script>
    var html = '',
      num = 2,
      data;
    getList()

    function getList() {
      // var ip = 'http://192.168.2.222:82'
      // var ip = 'https://check-h5.wanguowang.com'
      var ip = 'https://app.guobener.com'
      $('.loading').show();
      $.ajax({
        type: 'post',
        url: ip + '/wap/news/selectInforList',
        dataType: 'json',
        success: function (res) {
          $('.loading').hide();
          if (res.result.state != '1' || !res.data.length) {
            $('.paceholder').show();
            return
          }
          data = res.data
          page(1, res.data);
        }
      });
    }

    function page(num, data) {
      var n = (num - 1) * 10,
        length = data.length - n > 10 ? num * 10 : data.length;
      for (let i = n; i < length; i++) {
        html +=
          ` <li class="list">
              <a href="information-detail.html?id=${data[i].id}">
                <div class="list-l"><img src="${data[i].thumb}"></div>
                <div class="list-r">
                  <p class="title">${data[i].title}</p>
                  <p class="cont">${data[i].brief} </p>
                  <p class="date">发布时间：${data[i].deplayTime}</p>
                </div>
              </a>
              </li>`
      };
      $('.information-list').html(html);
      if (data.length - length < 10) {
        $('.tip-placeholder').show()
      }
    }
    $(window).scroll(function (e) {
      var cht = document.documentElement.clientHeight,
        ctp = document.documentElement.scrollTop,
        top = document.documentElement.scrollHeight,
        diff = top - ctp - cht;
      if (diff < 10) {
        page(num++, data)
      }
    });
  </script>
</body>

</html>
